/*
 * $Id: CharacterSequence.java 101 2013-01-14 12:51:21Z vladimirow@mail.ru $
 * $HeadURL: http://ultralog.googlecode.com/svn/ultralog/tags/release-0.1/src/java/com/google/code/ultralog/utils/CharacterSequence.java $
 *
 * This file is a part of ultralog project (http://code.google.com/p/ultralog/).
 * Released under New BSD License.
 */
package com.google.code.ultralog.utils;

/**
 * Sequence of characters.
 *
 * @author Mikhail Vladimirov
 */
public interface CharacterSequence
{
    /**
     * Get length of the sequence.
     *
     * @return length of sequence
     */
    public int getLength ();

    /**
     * Get character at given index.
     *
     * @param index index to get character at
     * @return character at given index
     */
    public char getCharacterAt (int index);

    /**
     * Copy range of characters into array at given offset.
     *
     * @param offset offset of the range to be copied
     * @param length length of the range to be copied
     * @param destination character array to copy characters to
     * @param destinationOffset offset within destination array to start copying
     *        at
     */
    public void copyCharacters (
        int offset, int length, char [] destination, int destinationOffset);

    /**
     * Write range of characters into given character output stream.
     *
     * @param offset offset of the range to be written
     * @param length length of the range to be written
     * @param destination character output stream to write characters to
     */
    public void writeCharactersTo (
        int offset, int length, CharacterOutputStream destination);
}
